package com.leaderhr.fishshop.controller.product;

import java.util.List;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;











import org.springframework.web.multipart.MultipartFile;

import com.leaderhr.fishshop.form.AdminPager;
import com.leaderhr.fishshop.form.DataGrid;
import com.leaderhr.fishshop.form.Json;
import com.leaderhr.fishshop.form.Pager;
import com.leaderhr.fishshop.form.ProductTypeForm;
import com.leaderhr.fishshop.form.Tree;
import com.leaderhr.fishshop.model.product.ProductBrand;
import com.leaderhr.fishshop.model.product.ProductType;
import com.leaderhr.fishshop.service.product.IProductBrandService;
import com.leaderhr.fishshop.service.product.IProductTypeService;

@Controller
@RequestMapping("/admin/product")
public class ProductBrandController {

	private IProductBrandService productBrandService;

	
	public IProductBrandService getProductBrandService() {
		return productBrandService;
	}
	@Inject
	public void setProductBrandService(IProductBrandService productBrandService) {
		this.productBrandService = productBrandService;
	}
	/**
	 * 获得商品类别列表
	 * @return
	 */
	@RequestMapping("/productBrands")
	@ResponseBody
	public DataGrid<ProductBrand> dataGrid(ProductBrand productBrand, AdminPager ap) {
		
		return productBrandService.dataGrid(productBrand, ap);
	}

	/**
	 * 添加品牌
	 * 
	 * @return
	 */
	@RequestMapping("/addProductBrand")
	@ResponseBody
	public Json add(ProductBrand productBrand,MultipartFile logopath) {
		Json obj = new Json();
		productBrandService.add(productBrand);
		obj.setSuccess(true);
		obj.setMsg("添加成功！");
		return obj;
	}


}
